{% extends "base.html" %}

{% block content %}
<div class="container">
    <div class="row mb-4">
        <div class="col-md-8">
            <h1>我的论文列表</h1>
        </div>
        <div class="col-md-4 text-end">
            <a href="{{ url_for('main.submit_thesis') }}" class="btn btn-primary">提交新论文</a>
        </div>
    </div>
    
    <div class="row">
        <div class="col-md-12">
            {% if theses %}
            <div class="table-responsive">
                <table class="table table-striped">
                    <thead>
                        <tr>
                            <th>论文题目</th>
                            <th>描述</th>
                            <th>开发语言</th>
                            <th>报价</th>
                            <th>状态</th>
                            <th>提交时间</th>
                        </tr>
                    </thead>
                    <tbody>
                        {% for thesis in theses %}
                        <tr>
                            <td>{{ thesis.title }}</td>
                            <td>
                                {% if thesis.description %}
                                <button type="button" class="btn btn-sm btn-link" data-bs-toggle="modal" data-bs-target="#descriptionModal{{ thesis.id }}">
                                    查看描述
                                </button>
                                <!-- 描述详情模态框 -->
                                <div class="modal fade" id="descriptionModal{{ thesis.id }}" tabindex="-1">
                                    <div class="modal-dialog">
                                        <div class="modal-content">
                                            <div class="modal-header">
                                                <h5 class="modal-title">论文描述</h5>
                                                <button type="button" class="btn-close" data-bs-dismiss="modal"></button>
                                            </div>
                                            <div class="modal-body">
                                                <p style="white-space: pre-wrap;">{{ thesis.description }}</p>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                                {% else %}
                                <span class="text-muted">无描述</span>
                                {% endif %}
                            </td>
                            <td>{{ thesis.programming_language }}</td>
                            <td>¥{{ "%.2f"|format(thesis.price) }}</td>
                            <td>
                                {% if thesis.status == 'pending' %}
                                <span class="badge bg-warning">待处理</span>
                                {% elif thesis.status == 'accepted' %}
                                <span class="badge bg-success">已接受</span>
                                {% elif thesis.status == 'completed' %}
                                <span class="badge bg-primary">已完成</span>
                                {% endif %}
                            </td>
                            <td>{{ thesis.created_at.strftime('%Y-%m-%d %H:%M') }}</td>
                        </tr>
                        {% endfor %}
                    </tbody>
                </table>
            </div>
            {% else %}
            <div class="alert alert-info">
                您还没有提交过论文信息。
                <a href="{{ url_for('main.submit_thesis') }}" class="alert-link">立即提交</a>
            </div>
            {% endif %}
        </div>
    </div>
</div>
{% endblock %} 